package com.duleme.servlet;

import com.duleme.common.EncodeUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import java.io.IOException;

@WebServlet(name = "FileLoadingServlet",urlPatterns = "/fileLoad")
@MultipartConfig(fileSizeThreshold = 1024*1024*2 ,maxFileSize = 1024*1024*20,maxRequestSize = 124*1024*200)
public class FileLoadingServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        EncodeUtils.setEncoding(request,response);
        Part part = request.getPart("file");
        String header = part.getHeader("content-disposition");
        System.out.println(header);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
